package com.songlanyun.modules.studyingType.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.songlanyun.common.drive.RootEntity;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Data
@TableName("yxt_studying_type")
public class StudyingType extends RootEntity<Long, StudyingType> implements Serializable {

    /**
     * id
     */
    @TableId
    private Long id;
    /**
     * 分类名称
     */
    @NotEmpty(message = "分类名称不能为空")
    private String studyTypeName;
    /**
     * 序号
     */
    @NotNull(message = "序号不能为空")
    private Integer hasOrder;
    /**
     * 上级id
     */
//    @NotNull(message = "上级id")
    private Long parentId = 0L;

    /**
     * 父级
     */
//    @NotNull(message = "父级")
    private String parentPatten;
    /**
     *
     */
    private Long createBy;
    /**
     *
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;
    /**
     *
     */
    private Long updateBy;
    /**
     *
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    @TableField(exist = false)
    List<StudyingType> studyingTypes;

    @Override
    public Long getIdentity() {
        return getId();
    }
}
